package io.github.codergjw.utils;import java.nio.charset.StandardCharsets;import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;/** * @ClassName: Sha256 * @Author: 小飞 * @Date: 2023/5/9 20:22 * @Description: SHA256 加密 */public class Sha256 {    public static byte[] digest(String str) {        MessageDigest messageDigest;        try {            messageDigest = MessageDigest.getInstance("SHA-256");            messageDigest.update(str.getBytes(StandardCharsets.UTF_8));            return messageDigest.digest();        } catch (NoSuchAlgorithmException e) {            e.printStackTrace();        }        return null;    }}